--    Author    : ChenErHao
--    Name      : DM.T_ODS_TMP_CURR_ORG.HQL
--    Functions : 为机构信息管理提供删除机构对照表
--    Purpose   :
--    Revisions or Comments
--    VER        DATE        AUTHOR           DESCRIPTION
--   ---------  ----------  ---------------  ------------------------------------
--    1.0        2019-01-25  ChenErHao       1.CREATE THE PROCEDURE
--
INSERT OVERWRITE TABLE DM.T_ODS_TMP_CURR_ORG PARTITION (P_MONTH = '#V_DATA_MONTH#') 
SELECT 
       DATA_SRC_ORG AS REPORT_ORG_CODE,
       DATA_ORG_CODE
  FROM EDW.DEPB
  WHERE DATA_DATE='#V_DATA_DATE#'
  GROUP BY DATA_SRC_ORG,DATA_ORG_CODE
UNION 
SELECT 
       DATA_SRC_ORG AS REPORT_ORG_CODE,
       DATA_ORG_CODE
  FROM EDW.LOAB
  WHERE DATA_DATE='#V_DATA_DATE#'
  GROUP BY DATA_SRC_ORG,DATA_ORG_CODE
UNION 
SELECT 
       DATA_SRC_ORG AS REPORT_ORG_CODE,
       DATA_ORG_CODE
  FROM EDW.LOAF
  WHERE DATA_DATE='#V_DATA_DATE#'
  GROUP BY DATA_SRC_ORG,DATA_ORG_CODE
;